<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    function Stack() {
      this.items = []
      Stack.prototype.push = function() {
        Array.from(arguments).forEach(item => {
          if (item instanceof Array) {
            this.push(...item)
          } else {
            this.items[this.items.length] = item
          }
        })
      }
    }
    let s = new Stack()
    console.log(s.items);
    s.push(1, 2, 3, 4, 5, [6, 7, 8, [9, 10]])

    let arr = []

    function getElement() {
      Array.from(arguments).forEach(item => {
        if (item instanceof Array) {
          getElement(...item)
        } else {
          arr[arr.length] = item
        }
      })
    }
    getElement(1, 2, 3, 4, 5, [6, 7, 8, [9, 10]])
    console.log(arr);
  </script>
</body>

</html>